package org.kommando.application.internal;

import org.kommando.application.actions.ExitAction;
import org.kommando.application.actions.OpenAction;
import org.kommando.application.core.ApplicationProvider;
import org.kommando.application.objectsource.ApplicationObjectSource;
import org.kommando.core.action.Action;
import org.kommando.core.catalog.ObjectSource;
import org.kommando.util.osgi.ServiceUtils;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

public class Activator implements BundleActivator {

    public void start(BundleContext context) throws Exception {
        ApplicationProvider applicationProvider = ServiceUtils.getService(context, ApplicationProvider.class);

        ApplicationObjectSource applicationObjectSource = new ApplicationObjectSource(applicationProvider);
        context.registerService(ObjectSource.class.getName(), applicationObjectSource, null);

        context.registerService(Action.class.getName(), new OpenAction(), null);
        context.registerService(Action.class.getName(), new ExitAction(), null);
    }

    public void stop(BundleContext context) throws Exception {
    }

}
